#ifndef ABSTRACTMANAGER_H
#define ABSTRACTMANAGER_H

#include <QtCore/QObject>

#include <vector>
#include <map>

class AbstractMappingWindow;
class NodeItem;
class LineItem;
class NodeInPort;
class NodeOutPort;
class NodePort;
class AbstractShapeItem;
class QPointF;
class xMappingTree;
class AbstractPanel;
class PanelItem;
class WOP_Entry;
class xMappingNode;

class AbstractManager
	: public QObject
{
	Q_OBJECT

public:
	AbstractManager(AbstractMappingWindow*);
	~AbstractManager();
	NodeItem* createNode(std::string );
	NodeItem* createNode(xMappingNode* );
	LineItem* createLine(NodeInPort* , NodeOutPort* );
	void deleteLine( LineItem* );
	void deleteNode(NodeItem*);
	std::vector<AbstractShapeItem*>& getNodeList();
	void removeAllLinks( AbstractShapeItem* node );
	NodePort* getCollidePort(QPointF);
	bool verifyLink(NodePort* , NodePort* );
	xMappingTree* getMappingTree();
	AbstractMappingWindow* getMappingDialog();
	bool validateAllNodes() const;
	void removeVMfromCompositeDes( QString, bool );
	bool isInForEachRect(AbstractShapeItem*);
	AbstractPanel * getInputPanel();
	AbstractPanel * getOutputPanel();
	xMappingTree* createXMTFromMDS(QString ,WOP_Entry* currentEntry=NULL );
	virtual AbstractPanel* createInputPanel()=0;
	virtual AbstractPanel * createOutputPanel() = 0;
	virtual void deletePanelItem(PanelItem*);

signals:
	void itemSelected(AbstractShapeItem*);
	void itemSelected(NodeItem*);
	void itemDeSelected();

protected:
	xMappingTree* xmt_;			// mapping tree
	AbstractMappingWindow* dialog_;
	AbstractPanel * inputPanel_;
	AbstractPanel * outputPanel_;
	std::vector<AbstractShapeItem*> nodeList_;
};

#endif // ABSTRACTMANAGER_H
